package com.fit.entities.manytomany;

import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Table;


@Entity
@Table(name="User_Sci_Field")
@AssociationOverrides({
	@AssociationOverride(name = "pk.user", joinColumns = @JoinColumn(name = "user_id")),
	@AssociationOverride(name = "pk.scientificField", joinColumns = @JoinColumn(name = "scientificField_id")) })
public class UserSciField {

	@EmbeddedId
	private UserSciFieldPk pk = new UserSciFieldPk();

	public UserSciFieldPk getPk() {
		return pk;
	}

	public void setPk(UserSciFieldPk pk) {
		this.pk = pk;
	}
	
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		UserSciField that = (UserSciField) o;

		if (getPk() != null ? !getPk().equals(that.getPk())
				: that.getPk() != null)
			return false;

		return true;
	}
}
